import { RouteRecordRaw } from "vue-router";
import { e403, e404, e500, home, Layout, login } from "../commonViews";

// 系统的公用模块
const commonRouter: Array<RouteRecordRaw> = [
  {
    path: "/",
    redirect: { name: "login" }
  },
  {
    path: "/login",
    name: "login",
    component: login,
    meta: {
      requiresAuth: false,
      title: "登录页",
      key: "login"
    }
  },
  {
    path: "/home",
    component: Layout,
    redirect: "/home/index",
    children: [
      {
        path: "/home/index",
        name: "home",
        component: home,
        meta: {
          keepAlive: true,
          requiresAuth: true,
          title: "首页",
          key: "home"
        }
      }
    ]
  },
  //   {
  //     path: "/cpyhome",
  //     component: Layout,
  //     redirect: "/cpyhome/index",
  //     children: [
  //       {
  //         path: "/cpyhome/index",
  //         name: "cpyhome",
  //         component: () => import("@/views/home/cpyhome/index.vue"),
  //         meta: {
  //           keepAlive: true,
  //           requiresAuth: true,
  //           title: "企业首页",
  //           key: "cpyhome"
  //         }
  //       }
  //     ]
  //   },
  {
    path: "/403",
    name: "403",
    component: e403,
    meta: {
      requiresAuth: false,
      title: "403页面",
      key: "403"
    }
  },
  {
    path: "/404",
    name: "404",
    component: e404,
    meta: {
      requiresAuth: false,
      title: "404页面",
      key: "404"
    }
  },
  {
    path: "/500",
    name: "500",
    component: e500,
    meta: {
      requiresAuth: false,
      title: "500页面",
      key: "500"
    }
  }
];

export default commonRouter;
